using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Ioc;
using Microsoft.Practices.ServiceLocation;
using Tisbi.LawFirm.BL.Services;
using Tisbi.LawFirm.BL.Services.Implementation;
using Tisbi.LawFirm.BL.Services.Implementation.Mock;
using Tisbi.LawFirm.DAL.Models;

namespace Tisbi.LawFirm.UI.ViewModel
{
    /// <summary>
    /// This class contains static references to all the view models in the
    /// application and provides an entry point for the bindings.
    /// </summary>
    public class ViewModelLocator
    {
        /// <summary>
        /// Initializes a new instance of the ViewModelLocator class.
        /// </summary>
        public ViewModelLocator()
        {
            ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);

            if (ViewModelBase.IsInDesignModeStatic)
            {
                // Create design time view services and models
                SimpleIoc.Default.Register<ICaseServiceAgent, MockCaseServiceAgent>();
                SimpleIoc.Default.Register<IEmployeesServiceAgent, MockEmployeeServiceAgent>();
                SimpleIoc.Default.Register<IServiceAgentBase<Court>, MockCourtServiceAgent>();
                SimpleIoc.Default.Register<IServiceAgentBase<CourtType>, MockCourtTypeServiceAgent>();
                SimpleIoc.Default.Register<IServiceAgentBase<District>, MockDistrictServiceAgent>();
                SimpleIoc.Default.Register<IServiceAgentBase<Customers>, MockCustomersServiceAgent>();
                SimpleIoc.Default.Register<ILawsuitsServiceAgent, MockLawsuitsServiceAgent>();
                SimpleIoc.Default.Register<IServiceAgentBase<StatementOfClaimType>, MockStatementOfClaimTypeServiceAgent>();
                SimpleIoc.Default.Register<IAppealsServiceAgent, MockAppealsServiceAgent>();
                SimpleIoc.Default.Register<IServiceAgentBase<Claims>, MockClaimsServiceAgent>();
            }
            else
            {
                // Create run time view services and models
                SimpleIoc.Default.Register<ICaseServiceAgent, CaseServiceAgent>();
                SimpleIoc.Default.Register<IEmployeesServiceAgent, EmployeeServiceAgent>();
                SimpleIoc.Default.Register<IServiceAgentBase<Court>, CourtServiceAgent>();
                SimpleIoc.Default.Register<IServiceAgentBase<CourtType>, CourtTypeServiceAgent>();
                SimpleIoc.Default.Register<IServiceAgentBase<District>, DistrictServiceAgent>();
                SimpleIoc.Default.Register<IServiceAgentBase<Customers>, CustomersServiceAgent>();
                SimpleIoc.Default.Register<ILawsuitsServiceAgent, LawsuitsServiceAgent>();
                SimpleIoc.Default.Register<IServiceAgentBase<StatementOfClaimType>, StatementOfClaimTypeServiceAgent>();
                SimpleIoc.Default.Register<IAppealsServiceAgent, AppealsServiceAgent>();
                SimpleIoc.Default.Register<IServiceAgentBase<Claims>, ClaimsServiceAgent>();
            }

            SimpleIoc.Default.Register<CaseViewModel>();
            SimpleIoc.Default.Register<EmployessViewModel>();
            SimpleIoc.Default.Register<CourtsViewModel>();
            SimpleIoc.Default.Register<CourtTypesViewModel>();
            SimpleIoc.Default.Register<DistrictViewModel>();
            SimpleIoc.Default.Register<CustomerViewModel>();
            SimpleIoc.Default.Register<LawsuitsViewModel>();
            SimpleIoc.Default.Register<StatementOfClaimTypesViewModel>();
            SimpleIoc.Default.Register<AppealsViewModel>();
            SimpleIoc.Default.Register<ClaimsViewModel>();
            SimpleIoc.Default.Register<LoginViewModel>();
            SimpleIoc.Default.Register<SqlConnectionStringViewModel>();
            SimpleIoc.Default.Register<AdminSettingsViewModel>();
        }

        public CaseViewModel CaseViewModel
        {
            get
            {
                return ServiceLocator.Current.GetInstance<CaseViewModel>();
            }
        }

        public EmployessViewModel EmployessViewModel
        {
            get
            {
                return ServiceLocator.Current.GetInstance<EmployessViewModel>();
            }
        }

        public CourtsViewModel CourtsViewModel
        {
            get
            {
                return ServiceLocator.Current.GetInstance<CourtsViewModel>();
            }
        }

        public DistrictViewModel DistrictViewModel
        {
            get
            {
                return ServiceLocator.Current.GetInstance<DistrictViewModel>();
            }
        }

        public CustomerViewModel CustomerViewModel
        {
            get
            {
                return ServiceLocator.Current.GetInstance<CustomerViewModel>();
            }
        }

        public LawsuitsViewModel LawsuitsViewModel
        {
            get
            {
                return ServiceLocator.Current.GetInstance<LawsuitsViewModel>();
            }
        }

        public CourtTypesViewModel CourtTypesViewModel
        {
            get
            {
                return ServiceLocator.Current.GetInstance<CourtTypesViewModel>();
            }
        }
        public StatementOfClaimTypesViewModel StatementOfClaimTypesViewModel
        {
            get
            {
                return ServiceLocator.Current.GetInstance<StatementOfClaimTypesViewModel>();
            }
        }
        public AppealsViewModel AppealsViewModel
        {
            get
            {
                return ServiceLocator.Current.GetInstance<AppealsViewModel>();
            }
        }
        public ClaimsViewModel ClaimsViewModel
        {
            get
            {
                return ServiceLocator.Current.GetInstance<ClaimsViewModel>();
            }
        }
        public LoginViewModel LoginViewModel
        {
            get
            {
                return ServiceLocator.Current.GetInstance<LoginViewModel>();
            }
        }
        public SqlConnectionStringViewModel SqlConnectionStringViewModel
        {
            get
            {
                return ServiceLocator.Current.GetInstance<SqlConnectionStringViewModel>();
            }
        }
        public AdminSettingsViewModel AdminSettingsViewModel
        {
            get
            {
                return ServiceLocator.Current.GetInstance<AdminSettingsViewModel>();
            }
        }
    }
}